#include "graph-node.h"
#include "product-in-warehouse-addition-dialog.h"
#include "product-in-warehouse-section-model.h"
#include "product-in-warehouse-section-view.h"

ProductInWarehouseSectionView::ProductInWarehouseSectionView(QWidget *parent) :
    StandardSectionView(parent)
{
}

void ProductInWarehouseSectionView::initialize()
{
    m_sectionModel = new ProductInWarehouseSectionModel(this);
    m_addDataText = "Dodaj produkt";
    m_editDataText = "Edytuj produkt";
    m_removeDataText = "Usuń produkt";
    m_removeDataEnabled = false;
    m_removeDataConfirmation = "Czy na pewno chcesz usunąć zaznaczone produkty z magazynu?";
    StandardSectionView::initialize();
}

void ProductInWarehouseSectionView::addData()
{
    ProductInWarehouseAdditionDialog* dialog = new ProductInWarehouseAdditionDialog(this);
    connect (dialog, SIGNAL(addDataRequested(QVariantList)), m_sectionModel, SLOT(addData(QVariantList)));
    dialog->setAttribute(Qt::WA_DeleteOnClose);
    dialog->setWindowTitle(m_addDataText);
    dialog->setSectionInfo(m_sectionNode->data());
    dialog->initialize();
    dialog->open();
}
